package org.bedracket.pgeg.datagen;

import net.minecraft.data.PackOutput;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import org.bedracket.pgeg.PGEGMod;
import org.bedracket.pgeg.init.ModBlocks;

import java.util.Objects;

public class ModBlockStateProvider extends BlockStateProvider {

    public ModBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
        super(output, PGEGMod.MOD_ID, exFileHelper);
    }

    @Override
    protected void registerStatesAndModels() {
        simpleBlockWithItem(ModBlocks.AIR_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.AQUA_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.ORDER_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.EARTH_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.FIRE_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.ENTROPY_INFUSED_STONE.get());
        simpleBlockWithItem(ModBlocks.AIR_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.AQUA_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.ORDER_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.EARTH_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.FIRE_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.ENTROPY_INFUSED_DEEPSLATE.get());
        simpleBlockWithItem(ModBlocks.BRIMSTONE_ORE.get());
        simpleBlockWithItem(ModBlocks.METEORITE_ORE.get());
        simpleBlockWithItem(ModBlocks.MITHRIL_ORE.get());
        simpleBlockWithItem(ModBlocks.ORICHALCUM_ORE.get());
        simpleBlockWithItem(ModBlocks.SATURNIUM_ORE.get());
        simpleBlockWithItem(ModBlocks.SILVER_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_BRIMSTONE_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_METEORITE_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_MITHRIL_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_ORICHALCUM_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_SATURNIUM_ORE.get());
        simpleBlockWithItem(ModBlocks.DEEPSLATE_SILVER_ORE.get());
    }

    private void simpleBlockWithItem(Block block) {
        simpleBlockWithItem(block, cubeAll(block));
    }

    private String name(Block block) {
        return Objects.requireNonNull(ForgeRegistries.BLOCKS.getKey(block)).getPath();
    }

}
